package cn.edu.hunau.java.week02.day03;

import java.util.Objects;

public class Card {
    private int rank;
    private int suit;

    public static final int RANK_3=0;
    public static final int RANK_4=1;
    public static final int RANK_5=2;
    public static final int RANK_6=3;
    public static final int RANK_7=4;
    public static final int RANK_8=5;
    public static final int RANK_9=6;
    public static final int RANK_10=7;
    public static final int RANK_J=8;
    public static final int RANK_QUEEN=9;
    public static final int RANK_KING=10;
    public static final int RANK_ACE=11;
    public static final int RANK_2=12;
    public static final int RANK_THREE=13;
    public static final int RANK_FOUR=14;

    public static final int SUIT_HEITAO=0;
    public static final int SUIT_HONGTAO=1;
    public static final int SUIT_MEIHUA=2;
    public static final int SUIT_FANGKUAI=3;
    public static final int SUIT_KUAN=4;

    public static final String[] RANKS={"3","4","5","6","7","8","9","10","J","Q","K","A","2"};
    public static final String[] SUITS={"♠","♥","♣","♦",""};

    @Override
    public String toString() {
        return SUITS[this.suit]+RANKS[this.rank];
    }

    public Card() {

    }

    public Card(int suit, int rank) {
        this.suit = suit;
        this.rank = rank;
    }

    public int getSuit() {
        return suit;
    }

    public void setSuit(int suit) {
        this.suit = suit;
    }

    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        this.rank = rank;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        Card card = (Card) o;
        return suit == card.suit && rank == card.rank;
    }

    @Override
    public int hashCode() {
        return Objects.hash(suit, rank);
    }
}
